﻿namespace AutoCompleteTextBox
{
    public class AutocompleteJSONPDataSource : AutocompleteDataSource
    {
        public string ResultListLocator { get; set; }

        public string ResultTextLocator { get; set; }

        public string PathToService { get; set; }

        public string RequestTemplate { get; set; }

        public override string RenderDataSource()
        {
            var so = GetSettingsObject();
            so.ClientID = ClientID.ToString();
            so.Source = "'" + PathToService + "'";
            so.ResultListLocator = ResultListLocator;
            so.ResultTextLocator = ResultTextLocator;

            RegistrarClientScript.ClientScriptManager(Page, ClientID, so.GetString());

            return ClientID.ToString();
        }
    }
}
